Data protection for unexpected power loss

ABSTRACT

A data storage device receives a write data command and data. The data is stored in a buffer of the data storage device. The data storage device issues a command complete status indication. After the command complete status indication is issued, the data are stored in a primary memory of the data storage device. The primary memory comprises a first type of non-volatile memory and the buffer comprises a second type of non-volatile memory that is different from the first type of non-volatile memory.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation-in-part of U.S. Ser. No. 13/761,965filed Feb. 7, 2013, and is a continuation-in-part of U.S. Ser. No.13/610,433, filed Sep. 11, 2012, which are incorporated herein byreference in their entireties.

SUMMARY

Paragraph 1. A method described herein includes:

receiving, in a data storage device, a write data command and data;

storing the data in a buffer of the storage device;

after storing the data in the buffer, issuing a command complete statusindication; and

after issuing the command complete status indication, storing the datain a primary memory of the storage device, wherein the primary memorycomprises a first type of non-volatile memory, the buffer comprises asecond type of non-volatile memory that is different from the first typeof non-volatile memory.

Paragraph 2. The method described in paragraph 1, wherein the secondtype of non-volatile memory has faster access time than the first typeof non-volatile memory.

Paragraph 3. The method described in any of paragraphs 1 through 2,wherein:

storing the data in the primary memory comprises storing the data inflash memory; and

storing the data in the buffer comprises storing the data in one or moreof STRAM, PCRAM, RRAM, and NVSRAM.

Paragraph 4. The method described in any of paragraphs 1 through 3,further comprising:

storing mapping metadata in the buffer, the mapping metadata includingmapping information between the logical block addresses of the data anda physical location of the data in the primary memory; and

after issuing the command complete status indication, storing themapping metadata in the primary memory.

Paragraph 5. The method described in any of paragraphs 1 through 4,further comprising:

accumulating data from multiple write data commands in the buffer untila threshold amount of data has been accumulated in the buffer; and

after the threshold amount of data has been accumulated in the buffer,storing accumulated data in the primary memory.

Paragraph 6. The method described in any of paragraphs 1 through 5,wherein: the primary memory comprises flash memory; and

the threshold amount of accumulated data is one logical page of data.

Paragraph 7. The method described in any of paragraphs 1 through 5,wherein:

The method described in of paragraph 5 wherein:

the primary memory comprises flash memory; and

the threshold amount of accumulated data is one physical page of data.

Paragraph 8. The method described in any of the paragraphs 1 through 5,wherein the primary memory comprises multi-level flash memory and thethreshold amount of accumulated data is sufficient to allow at least onepage of accumulated data to be stored in the flash memory; and

further comprising:

-   -   reading one or more pages from each physical page in the at        least one block of the primary memory where the at least one        page is to be stored;    -   storing the other pages in the buffer; and    -   after the at least one page has been accumulated, storing the        page and the other pages in the physical page of the primary        memory.

Paragraph 9. The method described in paragraph 8, wherein reading theother pages occurs before accumulating the page.

Paragraph 10. The method of described in paragraph 8, wherein readingthe other pages occurs during accumulating the page.

Paragraph 11. The method described in any of paragraphs 1 through 10,further comprising:

counting numbers of times regions of logical blocks within the datastorage device have been written;

accumulating data from multiple write data commands in the buffer; and

determining if regions of logical blocks are infrequently-written orfrequently-written based on the numbers; and

storing data for the infrequently-written regions of logical blocks intothe primary memory before storing data for the frequently-writtenregions of logical blocks.

Paragraph 12. The method of described in any of paragraphs 1 through 11,further comprising updating metadata that provides status of the writeoperation.

Paragraph 13. The method described in paragraph 12, wherein updating themetadata comprises updating the metadata to indicate a write operationis in progress after the write data command is received.

Paragraph 14. The method described in paragraph 12, wherein updating themetadata comprises updating the metadata to indicate that the data havebeen received.

Paragraph 15. The method described in paragraph 12, wherein updating themetadata comprise updating the metadata to indicate that the writeoperation is complete after storing the data in the primary memory.

Paragraph 16. A device, comprising:

an interface configured to receive a write data command and data;

a primary memory comprising a first type of non-volatile memory;

a buffer comprising a second type of non-volatile memory different fromthe first type of non-volatile memory; and

a controller configured to:

-   -   cause the data to be stored in the buffer;    -   after the data are stored in the buffer, issue a command        complete status indication indicating the write data command is        complete; and    -   after the command complete status indication is issued, cause        the data to be stored in the primary memory.

Paragraph 17. The device described in paragraph 16, wherein the secondmemory type comprises one or more of non-volatile static random-accessmemory (NVSRAM), phase-change memory (PCM), resistive random-accessmemory (RRAM), spin-torque RAM (STRAM), and magnetic RAM (MRAM).

Paragraph 18. The device described in any of paragraphs 16 through 17,wherein the device comprises a solid state drive and the first memorytype comprises flash memory.

Paragraph 19. The device described in any of paragraphs 16 through 18,wherein the device comprises a hybrid drive.

Paragraph 20. The device described in any of paragraphs 16 through 19wherein the controller is configured to pre-compensate for write disturbeffects when the data are stored in the primary memory.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a system that includes a data storagedevice according to embodiments discussed herein;

FIG. 2 provides a flow diagram of a process of operating a data storagedevice to perform a write operation in accordance with some embodiments;

FIG. 3 is flow diagram illustrating a process that includes storing dataand updating metadata during a write operation;

FIG. 4 depicts possible voltage levels that can be used to represent twobits of data in a hypothetical two level memory cell; and

FIG. 5 illustrates a process of accumulating data prior to storing inprimary memory in accordance with some embodiments.

DETAILED DESCRIPTION

On a write operation, the successful reception and storage of data sentto a data storage device, such as a hard disk drive, a solid state driveor hybrid disk drive is typically acknowledged to the sending device,e.g., the host, via a “command complete” status message indication(CCI). For example, a Serial-Attached-SCSI hard disk drive with volatilewrite caching disabled will typically send such a message on a writecommand operation after data are written to the media. To maintain dataintegrity, it is desirable that data sent for storage will not be lostin the event that the data storage device suddenly loses supplied power.However, to provide optimal system throughput, it can be beneficial toreturn a CCI from the data storage device to the host even through thedata sent from the host has not yet been stored in its final memorylocation in the data storage device. Preemptively sending the CCI beforethe data are stored in their final memory locations can be beneficial tothe performance of both the host and the data storage device. Data arenormally kept in the host system until CCI is received from the datastorage device in case of a fault within the data storage device. Thereception of CCI allows the host system to free its data buffers for newwork. For the data storage device, the preemptive sending of CCIpotentially allows for additional new commands to be sent by the hostsystem, increasing the possibility for parallel processing of commandsand for merging of complementary commands, e.g. sequential operationsspanning across command boundaries. However, data integrity may becompromised if a power outage occurs after the CCI is sent to the hostbut before the data along with any corresponding metadata are saved tonon-volatile memory.

Although the technique of returning the CCI prior to the data beingstored in its final non-volatile memory location can increase datathroughput, this technique and the avoidance of data loss has led toadditional electrical energy-storage components e.g. battery backupand/or capacitive energy storage. These additional energy-storagecomponents are designed to maintain backup power for the data storagedevice that is sufficient to allow a data storage operation to becompleted even though a loss of main power occurs while the data arebeing stored. Incorporating the additional hardware adds to thecomplexity, cost, and size of the device.

Additional complexity is introduced due to the need to maintain mappingmetadata to keep track of where data are stored in the primary memory.In general, data stored in most data storage devices is not directlymapped between its logical address (used by the host) and a physicallocation in primary storage. Instead, mapping metadata keeps track ofthe location of logical blocks in the physical locations in primarystorage. Accurately maintaining the mapping metadata even in the eventof unexpected power loss enhances data integrity of the data storagedevice. Because mapping metadata are frequently updated, it is helpfulto store the mapping metadata in fast, durable memory. Volatile memorysuch as SRAM or DRAM have the speed and durability characteristicscompatible for mapping metadata, but are volatile and lose theircontents when power is lost. Storing metadata in slower, less durable,non-volatile memory adds to write amplification and wear on thenon-volatile storage components, and reduces performance.

Embodiments described herein incorporate a secondary non-volatile memorywith a faster access time and/or higher durability than the primarynon-volatile memory. In these embodiments, the secondary non-volatilememory acts as a buffer for the primary non-volatile memory, where theprimary non-volatile memory generally serves as the final storagelocation for user data. In the embodiments discussed herein, the CCI issent from the data storage device to the host after the data are storedin the secondary non-volatile memory but before the data are stored inthe primary memory. Note that the terms “primary memory” and “secondarymemory” are used herein to denote differences in memory (e.g., usage,capacity, performance, memory class or type, etc.) and not necessarilyorder or preference.

In some storage device configurations, the primary memory is solid statememory, such as NAND or NOR flash memory. Flash memory generally refersto electrically erasable and programmable memory based on floating gateFET technology. Flash memory is becoming an increasingly importantstorage technology and has been used as a primary storage memory insolid state drives (SSDs). Flash memory is also used in conjunction withhard disk (rotating disk) memory in hybrid drives. In some arrangements,where the primary memory is flash or hard disk, the secondary memory maybe a non-volatile memory that is faster and/or more durable than flashmemory, such as phase change memory (PCM), resistive random accessmemory (RRAM), spin-torque random access memory (STRAM) and/ornon-volatile static random access memory (NVSRAM). PCM and RRAM can bethousands of times more durable than NAND flash (in terms ofreprogramming cycles), and are also bit-alterable. STRAM and nvRAMdevices have nearly unlimited durability, and are also bit-alterable.

FIG. 1 is a block diagram of a system showing a data storage device 101and a host 140. The data storage device 101 includes a nonvolatileprimary memory 110, e.g., flash, hard disk, or other nonvolatile memory,and a nonvolatile secondary memory 120, e.g., STRAM, PCRAM, RRAM,NVSRAM, or other types of nonvolatile memory. The primary memory 110typically includes a large number of data storage locations 111 and thesecondary memory 120 typically includes fewer data storage locations121. In many arrangements, the secondary memory 120 has faster accesstime and/or is more durable than the primary memory. Note that theprimary memory may include multiple types of memory, such as flash andhard disk memory used together in a hybrid drive. Similarly, thesecondary memory 120 may also use multiple memory types.

The data storage device 101 includes a controller 130 that couples theprimary memory 110 that includes a large number of data storagelocations, and the secondary memory 120 to the host 140. The controller130 controls read and write accesses to the primary 110 and secondary120 memory. For example, the host 140 may issue a write command to thedata storage device 101, wherein the write command includes the data tobe stored and the logical block addresses (LBAs) of the data. Thecontroller 130 receives the data storage command from the host andcontrols the secondary memory 120 and the primary memory 110 so that thedata sent from the host 140 is stored in a final destination memorylocation 111 in the primary memory 110. The term “final destination” ofthe data as used herein refers to the final destination of the data inthe context of the data storage command being executed, even though thedata stored in the primary memory may not necessarily reside in thisfinal destination permanently and, after execution of the data storagecommand, may be moved to other memory locations in the primary memory orelsewhere as a result of garbage collection and/or other deviceoperations. As a part of a data storage operation being executed, thecontroller 130 generates mapping metadata that maps the host LBAs of thedata to the physical locations of the data in the primary memory 110and/or secondary memory 120. Additionally, the controller 130 generatesvarious handshaking signals which are returned to the host 140 andindicate the status of the data storage command, such as the CCI signalindicated in FIG. 1.

FIG. 2 shows a flow diagram of a process of operating a data storagedevice according to various embodiments described herein. As previouslydiscussed, the data storage device includes a primary memory and asecondary memory used mostly as a buffer. The primary memory comprises afirst type of non-volatile memory and the buffer comprises a second typeof non-volatile memory, where the second type of non-volatile memory hashigher access speed and/or greater durability than the first type ofnon-volatile memory. The data storage device receives 210 a writecommand from a host requesting that data be stored in the data storagedevice. The data are initially stored 220 in the buffer. After the dataare stored in the buffer, the controller sends a CCI command 230 to thehost, wherein the CCI command indicates to the host that the data in thewrite command has been stored. After the CCI command has been sent tothe host, the data are stored 240 in the primary memory.

In some arrangements, the data storage device may selectively store datain the buffer. For example, in some cases, the write command may includeand/or the controller may determine a priority level for the data in thewrite data command. If the priority level of the data is below apredetermined threshold priority, the controller may bypass the bufferand may directly store the data in the primary memory. If the prioritylevel of the data is greater than or equal to the threshold priority,the data are first stored in the buffer before being stored in theprimary memory. In some cases, it may be desirable to retain some datain the buffer indefinitely. For example, data that is deemed to be moreimportant to the performance of the system, such as data for LBAs thatare frequently read, may be kept in the buffer. As another example, datafor LBAs that are frequently rewritten may be kept in the buffer inpreference to data from LBAs that are rarely rewritten in order toreduce wear or to improve performance. As yet another example, data thatare stored elsewhere (duplicated) may have a lower buffer-retentionpriority than data that are not stored elsewhere. In some cases, userdata may be determined to be more important and therefore have a higherpriority than other data, such as internal drive logs and journals thatare not essential to the device's data integrity.

In some embodiments, the controller counts the number of times regionsof logical blocks within the data storage device have been written. Datafrom multiple write data commands are accumulated in the buffer. Thecontroller determines if regions of logical blocks areinfrequently-written or frequently-written based on the numbers counted.The controller causes the buffered data for infrequently written LBAregions to be stored before the buffered data for frequently written LBAregions.

During the write operation illustrated in FIG. 2, the controller canupdate metadata that records the progress of the write operation. Thewrite operation metadata can be stored in the buffer or in othernon-volatile memory, such as non-volatile registers of the controller(if available). For example, the write operation metadata can be updatedto indicate information such as: a write operation is in progress, awrite operation is complete, the LBAs and/or length of data to bestored, the accumulation of data prior to storing the accumulated datain the primary memory.

In most solid stated drive designs, the logical block addresses (LBAs)used by the host are not directly mapped to the physical locations inthe primary memory. The controller uses mapping metadata to keep trackof the physical memory locations of the host LBAs. Accuratelymaintaining the mapping metadata even in the event of unexpected hostsystem power loss helps to ensure the data integrity of the data storagedevice. To reduce the possibility of losing the mapping metadata duringa power disruption, the mapping metadata can be stored in thenon-volatile memory, e.g., the non-volatile buffer or other non-volatileregisters (if available) of the controller, until the mapping metadatais transferred to the primary memory.

As the write operations are serviced by the controller, the writeoperation metadata and mapping metadata are usually updated frequently.In some configurations, the non-volatile buffer is used to store writeoperation metadata and/or mapping metadata. Using the non-volatilebuffer protects the metadata from loss in the event of a powerdisruption. If the buffer has faster access time than the primarymemory, frequent updates to the metadata can be performed mostexpeditiously by using the buffer. If the buffer has more robustdurability than the primary memory, the frequent updates to the metadatareduce wear of the primary memory. It can be helpful to perform updatesto the metadata atomically, where updating atomically corresponds toupdating the metadata in the smallest increments of the write operationpossible. If the metadata cannot be incremented atomically, it can beupdated in the smallest increments of the write operation that willmaintain a risk of data loss less than a predetermined probability.Alternatively or additionally, when the metadata are not able to beupdated atomically, semaphores, essentially indicating that an “updateis in progress—use alternate copy”, can be maintained to track andprotect against corruption from power loss while a metadata update is inprogress.

FIG. 3 provides a flow diagram illustrating a process that includesstoring data and updating metadata during a write operation. Accordingto the process shown in FIG. 3, the controller receives 305 a writecommand from the host and initiates a write operation. The writeoperation metadata is optionally updated 310 to indicate that the writeoperation is in progress. In some cases, the write operation metadatamay include additional information about the write operation, such asthe current status of the write operation. The data are transferred 315from the host and the data are stored 320 in the buffer. After the dataare stored in the buffer, the write operation metadata are updated 325to indicate that the data storage device has received the data (and isabout to return CCI status to the host). The controller generates andsends 330 a CCI for the write operation to the host. With the datasecurely stored in the non-volatile buffer, the controller may initiatethe transfer 335 of data from the buffer to the primary memory. Thistransfer 335 is at the discretion of the controller logic. The logic mayselect to defer storage until later, for example to coalesce the datawith other incoming data. The controller may store 340 the mappingmetadata to the primary memory. The controller updates 345 the writeoperation metadata to indicate that the write operation is complete. Ifthe mapping metadata are written to primary memory, the buffer locationused to temporarily store the mapping metadata for the memory writeoperation is no longer needed, and is added to the available buffermemory locations. When the write operation in progress flag is cleared,indicating that the write operation is complete, the buffer locationsused or reserved for the write operation are returned to the pool ofavailable buffer locations.

In a multi-level memory, more than one bit of data can be stored in asingle cell. For devices that group storage cells into pages, such aswhat is commonly done in NAND flash devices, multiple logical data pagescan be stored in a single physical page of memory. These multiplelogical data pages that are stored in a single physical page of memoryare referred to herein as companion pages. Using four level memory as anexample, each four level memory cell can store two bits of information.In a device that arranges these cells into pages, each physical page offlash memory cells can store two logical (companion) pages. In oneconfiguration, a first logical page (denoted as the lower page) can bestored in the most significant bits (MSBs) of the memory cells of aphysical page of memory cells and a second logical page (denoted theupper page) can be stored in the least significant bits (LSBs) of thephysical page of memory cells. It is possible to write multi-level datato the physical page of memory cells in several ways. In one scenario,the lower page is stored first by storing the MSBs in the physicalmemory cells. After the lower page is written, the upper page is laterstored to the physical memory cells by further altering the state of thephysical memory cells.

Consider the possible voltage levels that can be used to represent twobits of data in a hypothetical two level memory cell illustrated in FIG.4. In this example, the voltage level V1 corresponds to the two bits ofdata 11 (binary), the voltage V2 corresponds to the two bits of data 10,the voltage V3 corresponds to 01, and the voltage V4 corresponds to 00.Data YX can be written to the memory cell in a two-step process ofwriting Y (the MSB) in a first step followed by writing X (the LSB) in asecond step. After the first step of writing Y, the voltage level of thememory cell is V1 (if Y=1) or V3 (if Y=0). In the second step, thevoltage level of the memory cell remains at V1 (if YX=11) or the voltagelevel is brought to V2 (if YX=10) or the voltage level remains at V3 (ifYX=01) or the voltage level is brought to V4 (if YX=00).

In some scenarios, data can be written to the multi-level memory cell ina single step process. For example, considering the memory cell of FIG.4, in a single step process, the voltage of the memory cell is brought(or left at) level V1 if YX=11, the voltage level of the memory cell isbrought to level V2 if YX=10, the voltage level of the memory cell isbrought to level V3 if YX=01, the voltage level of the memory cell isbrought to level V4 if YX is 00.

The usage of “voltages levels” to record data in the preceding exampleis for exemplary purposes. In other examples, the data could be storedand sensed as magnetic states, charge levels, resistance levels, etc.and the technique is still applicable.

When data are written to companion lower and upper pages of a physicalmemory page in the two step process outlined above, data stored in anlower page of the primary memory can be corrupted when a power lossoccurs during the time that a corresponding upper page is being storedin the primary memory. To reduce the possibility of this type of datacorruption, when data from a write data command is to be stored in anupper page of the primary memory, the corresponding lower page is readfrom the primary memory into the buffer to protect against the contentsof the lower page being corrupted due to power loss during the upperpage programming. Error correction may be performed on the lower pagewhen the lower page is read from the primary memory.

In some scenarios, it can be more efficient if a certain amount of dataare accumulated in the buffer before the write operation to the primarymemory occurs. For example, some types of memory are written inpredetermined units, e.g., flash memory is generally written in pages.According to the process of FIG. 5, the data storage device receives 520a write command from the host and accumulates 530 data from the writecommands in the buffer. The data accumulation continues 540 until athreshold amount of data has been accumulated. The threshold amount cancorrespond to the memory unit of a write operation for the primarymemory. If the primary memory is a multi-level memory, data can beaccumulated from the write commands until all logical pages (lower,upper, and any intermediate pages) to be stored in each physical page ofthe primary memory write unit are accumulated.

In some scenarios, before, during, and/or after the data from the writecommands are being accumulated in the buffer, the controller mayoptionally read the companion pages for this accumulated data from theprimary memory into the buffer. This optional process is indicated bythe dashed box 510. Note that the arrangement of blocks in the flowdiagrams provided herein are not meant to imply any particular order ofcarrying out processes described in the blocks. For example, althoughthe read operation is shown ahead of the reception of write data 520, itcould just as well occur simultaneously or after reception of the writedata 520. When the desired amount of data is obtained, throughaccumulation of the data from the write commands and optionally byreading the companion pages from the primary memory, the accumulateddata pages and their companion pages are written 550 to the primarymemory.

In some embodiments, when multi-level primary memory is used, logicaldata pages may be written to a physical pages of the primary memory in awriting process that separately writes a lower page, an upper page andany number of intermediate pages to each physical page of the primarymemory. Alternatively, the lower, upper, and intermediate pages can bewritten to a physical page of the primary memory pages in a single stepprocess by directly transitioning each memory cell to the voltage levelthat corresponds to the multi-bit data stored in the memory cell.

Some types of non-memory, such as flash, experience disturb effectsduring write operations. For example, the data stored in a memory cellmay be changed when a nearby memory cell is written to. When these typesof memory are used as the primary memory, the data pages may be writtento the primary memory according to a process that reduces these writedisturb effects.

As previously discussed, in a two-step process, lower data pages may bewritten to a physical page first. During the time that the lower page iswritten, one of its physically adjacent neighbor pages is un-programmed.Later, the companion upper page is programmed. At the time the upperpage is programmed, the physically adjacent neighbor page is eitherunprogrammed or programmed to only one bit per cell (only its lower pageis programmed). When the neighbor page is unprogrammed or only partiallyprogrammed, the page being programmed is uncompensated for the couplingeffects of the charge level of the neighbor page. When the neighbor pageis eventually fully programmed, the levels of the previously programmedpage can shift. For example, in a NAND flash, the close proximity ofstorage cell floating gates causes capacitive coupling between the gatesof neighboring cells that shifts storage cell levels from their ideallevels.

In some embodiments, the non-volatile buffer described herein canaccumulate multiple pages of data and multiple adjacent pages can beprogrammed simultaneously or in a coordinated way that reduced writedisturb effects. According to this process, either prior to or whilefully programming a page, its neighbor page is also programmed, but only“softly”. In this context, programming “softly” means that the neighborpage is “underprogrammed” to a charge level that approaches its targetvalue, but is enough below its final charge level to allow for possiblelevel-compensation required by its neighbor. The purpose of “softly”programming the neighbor is to impart enough of the final charge levelsinto the neighbor page so that its coupling effects are mostlycompensated for during programming. This coordinated programming ofneighboring pages allows the write operation to pre-compensate forpotential write disturbs. The buffer discussed herein can be used tofacilitate the pre-compensated write operation by storing a sufficientamount of data that allow the controller to “look forward” to data thatwill be programmed. The controller can then determine the appropriatelevels of the “soft” programming that will bring the neighboring pageclose enough to the final charge levels so that the coupling that causeswrite disturb is significantly pre-compensated.

For example, consider a hypothetical NAND flash with fourphysically-adjacent pages: A, B, C, and D (A and D are edge pages withonly one neighbor). A pre-compensated write operation would work asfollows:

1. Gather data to be programmed for pages A and B.

2. Softly program page B.

3. Program page A to its final levels.

4. Gather data for page C.

5. Softly program page C.

6. Program page B to its final levels.

7. Gather data for page D.

8. Softly program page D.

9. Program page C to its final levels.

10. Program page D to its final levels.

Processes 1-10 above could be repeated twice, once for the lower pages,and once for the upper logical pages or could be applied to the only theupper pages.

In an alternative process, at some point in time prior to normaloperation, the coupling of adjacent bit cells is characterized. Thischaracterization used to determine coupling compensation coefficientswhich can be used in pre-compensating for write disturb effects.Depending upon variability of coupling, the quantity of couplingcoefficients stored can be traded-off against the desired improvement inerror rate.

In some designs, coupling coefficients can be determined and used tocompensate for write disturb effects when programming bit cells multiplepages away (cells in pages to the sides of the bit cell) and multiplebit positions away (cells in the same page word line before and after)from the cell being programmed. Coupling coefficients can be determineddependent upon page number, for example, to mitigate die locationeffects.

In some implementation, during normal device operation, the writeprocess operates as follows:

1. Gather the data to be stored for both a storage cell and anysignificantly-coupled nearby cells.

2. Until fully collected, accumulate and hold this data prior to storingin a final destination in the buffer.

3. While programming a page, compensate the level of each storage cellto mitigate the effects of the neighboring cells using the couplingcoefficients and data.

4. Repeat until all data are stored.

The following hypothetical example illustrates a pre-compensated writeoperation according to some embodiments

Assume a hypothetical NAND flash primary storage storing two bits/cell(four charge levels). Assume during manufacturing it is determined thatadjacent pages cause a shift of 2% per cell level difference. Normalizedcell charge levels are 0.95, 0.6, 0.3, and 0.05 Volts, corresponding tostored data bits of 11, 10, 01, and 00.

Assume cell 1 will be programmed to 01 (with the nominal level of 0.3).With no consideration of adjacent bit cells, the cell would beprogrammed to a charge level of 0.3.

Assume the adjacent yet-to-be programmed page contains an adjacent cell(cell 2) storing data 00. Instead of programming cell 1 to a level of0.3, the following compensation calculation is performed:Compensation for the 00 adjacent page cell (cell 2)=+(0.3*0.02)=0.0060.006(compensation value)+0.3(nominal value)=0.306(new target value)Thus, for cell 1 would be programmed to a charge level of 0.306 (insteadof 0.3) to pre-compensate for the adjacent cell's (cell 2) futureprogramming level.

In this implementation the compensation would likely only be done on thecells containing 10 and 01 values. Cells with 11 or 00 would alwaysremain at the 0.95/0.05 values for best signal to noise ratio (SNR).

Note that the effects of already-programmed cells are also compensatedfor. Because these cells are already they are already programmed, theircoupling effects would inherently be sensed and compensated for(post-compensation) while the cell is being programmed. The processedoutlined above provides for both pre-compensation (e.g., adjustingprogramming voltage levels to compensate for write disturb effectspotentially caused by cells that are not yet programmed) andpost-compensation (adjusting programming voltage levels to compensatefor write disturb effects potentially caused by previously programmedcells).

It is to be understood that this detailed description is illustrativeonly, and various additions and/or modifications may be made to theseembodiments, especially in matters of structure and arrangements ofparts and/or processes. Accordingly, the scope of the present disclosureshould not be limited by the particular embodiments described above, butshould be defined by the claims set forth below and equivalents thereof.

What is claimed is:
 1. A method, comprising: receiving, in a datastorage device, a write data command to store data in a primary memoryof the data storage device; storing the data in a buffer of the storagedevice; after storing the data in the buffer, issuing a command completestatus indication indicating that the write data command has beencompleted; and after issuing the command complete status indication,storing the data in the primary memory of the storage device, whereinthe primary memory comprises a first type of non-volatile memory, thebuffer comprises a second type of non-volatile memory that is differentfrom the first type of non-volatile memory.
 2. The method of claim 1,wherein the second type of non-volatile memory has faster access timethan the first type of non-volatile memory.
 3. The method of claim 1,wherein: storing the data in the primary memory comprises storing thedata in flash memory; and storing the data in the buffer comprisesstoring the data in one or more of STRAM, PCRAM, RRAM, and NVSRAM. 4.The method of claim 1, further comprising: storing mapping metadata inthe buffer, the mapping metadata including mapping information betweenthe logical block addresses of the data and a physical location of thedata in the primary memory; and after issuing the command completestatus indication, storing the mapping metadata in the primary memory.5. The method of claim 1, further comprising: accumulating data frommultiple write data commands in the buffer until a threshold amount ofdata has been accumulated in the buffer; and after the threshold amountof data has been accumulated in the buffer, storing accumulated data inthe primary memory.
 6. The method of claim 5, wherein: the primarymemory comprises flash memory; and the threshold amount of accumulateddata is one logical page of data.
 7. The method of claim 5 wherein: theprimary memory comprises flash memory; and the threshold amount ofaccumulated data is one physical page of data.
 8. The method of claim 5wherein the primary memory comprises multi-level flash memory and thethreshold amount of accumulated data is sufficient to allow at least onepage of accumulated data to be stored in the flash memory; and furthercomprising: reading one or more pages from each physical page in the atleast one block of the primary memory where the at least one page is tobe stored; storing the other pages in the buffer; and after the at leastone page has been accumulated, storing the page and the other pages inthe physical page of the primary memory.
 9. The method of claim 8,wherein reading the other pages occurs before accumulating the page. 10.The method of claim 8, wherein reading the other pages occurs duringaccumulating the page.
 11. The method of claim 1, further comprising:counting numbers of times regions of logical blocks within the datastorage device have been written; accumulating data from multiple writedata commands in the buffer; and determining if regions of logicalblocks are infrequently-written or frequently-written based on thenumbers; and storing data for the infrequently-written regions oflogical blocks into primary memory before storing data for thefrequently-written regions of logical blocks.
 12. The method of claim 1,further comprising updating metadata that provides status of the writeoperation.
 13. The method of claim 12, wherein updating the metadatacomprises updating the metadata to indicate a write operation is inprogress after the write data command is received.
 14. The method ofclaim 12, wherein updating the metadata comprises updating the metadatato indicate that the data have been received.
 15. The method of claim12, wherein updating the metadata comprise updating the metadata toindicate that the write operation is complete after storing the data inthe primary memory.
 16. A device, comprising: an interface configured toreceive a write data command and data; a primary memory comprising afirst type of non-volatile memory, wherein the write data command is awrite data command to store data in the primary memory; a buffercomprising a second type of non-volatile memory different from the firsttype of non-volatile memory; and a controller configured to: cause thedata to be stored in the buffer; after the data are stored in thebuffer, issue a command complete status indication indicating the writedata command is complete; and after the command complete statusindication is issued, cause the data to be stored in the primary memory.17. The device of claim 16, wherein the second memory type comprises oneor more of non-volatile static random-access memory (NVSRAM),phase-change memory (PCM), resistive random-access memory (RRAM),spin-torque RAM (STRAM), and magnetic RAM (MRAM).
 18. The device ofclaim 16, wherein the device comprises a solid state drive and the firstmemory type comprises flash memory.
 19. The device of claim 16 whereinthe device comprises a hybrid drive.
 20. The device of claim 16 whereinthe controller is configured to pre-compensate for write disturb effectswhen the data are stored in the primary memory.